package com.gxd.business.utils;

import com.gxd.system.service.ISysConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * 系统配置工具类（静态方法调用）
 * @author gxd
 * @since 2025/6/15
 */
@Component
@Lazy(false)
public class SysConfigUtil {

    private static ISysConfigService sysConfigService;

    @Autowired
    private ISysConfigService configService;

    // 初始化
    @PostConstruct
    private void init() {
        sysConfigService = this.configService;
    }

    /**
     * 根据配置键获取配置值
     * @param configKey 配置键
     * @return 配置值
     */
    public static String getConfigValue(String configKey) {
        return sysConfigService.selectConfigByKey(configKey);
    }
}
